package com.example.zhilongzhang.constructionpayapp.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.example.zhilongzhang.constructionpayapp.R;
import com.example.zhilongzhang.constructionpayapp.base.ActivityCache;
import com.example.zhilongzhang.constructionpayapp.base.BaseActivity;
import com.example.zhilongzhang.constructionpayapp.util.SpUtil;

public class OptionActivity extends BaseActivity implements View.OnClickListener{
    ImageView ivBack;
    RelativeLayout rlUpdatePassword;
    RelativeLayout rlQuit;
    CheckBox box;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_option);
        box = findViewById(R.id.checkbox);
        ivBack = findViewById(R.id.left);
        rlUpdatePassword = findViewById(R.id.rl_update_password);
        rlQuit = findViewById(R.id.rl_quit);
        ivBack.setOnClickListener(this);
        rlUpdatePassword.setOnClickListener(this);
        rlQuit.setOnClickListener(this);
        box.setChecked(SpUtil.getDaYin());
        box.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                SpUtil.setDaYin(b) ;
            }
        });

    }
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.left:
                finish();
                break;
            case R.id.rl_update_password:
                Intent intent2 = new Intent(this,ResetPasswordActivity.class);
                startActivity(intent2);
                break;
            case R.id.rl_quit:
                ActivityCache.getScreenManager().popAllActivityExceptOne(LoginActivity.class);
                startActivity(new Intent(this, LoginActivity.class));
                break;
        }
    }
}
